from django.shortcuts import render
from rest_framework import viewsets

from idcs.models import Idc
from idcs.serializers import IdcSerializer
from idcs.filter import IdcFilter


class IdcViewset(viewsets.ModelViewSet):
    """
    list: 返回IDC列表
    retrieve: 返回单个IDC信息
    update: 更新IDC信息
    destroy: 删除IDC记录
    create: 创建IDC记录
    partial_update: 更新记录的部分字段
    """
    queryset = Idc.objects.all()
    serializer_class = IdcSerializer
    filter_class = IdcFilter
    filter_fields = ('name',)
